﻿using KillBill.Presentation.Common;
using KillBill.Presentation.Modules.Administration.AdministrationServiceReference;
using KillBill.Presentation.Modules.Administration.IView;

namespace KillBill.Presentation.Modules.Administration.Presenter
{
    public class CustomerListPresenter
    {
        public ICustomerList View { get; set; }

        private readonly AdministrationServiceClient _service;

        public CustomerListPresenter(ICustomerList view)
        {
            _service = new AdministrationServiceClient();
            View = view;
            View.Customers = _service.GetCustomers(Context.SessionID).Customers;
        }

        public void Find(string value)
        {
            View.Customers = _service.FindCustomers(value, Context.SessionID).Customers;
        }
    }
}
